﻿@using TomNet.IMSC.Model.DbModels.NewHouse;

@{
    Layout = null;
    //var depart = ViewData["select_depart"] as SelectList;
    //var position = ViewData["select_position"] as SelectList;
    //var roles = ViewData["select_role"] as SelectList;
    var entity = ViewData["entity"] as NewHouseRunnings;
    var state = Convert.ToInt32(ViewData["state"].ToString());
}

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="~/Content/Css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css?v=4.1.0" rel="stylesheet">
    <link href="~/Content/common.css" rel="stylesheet">
    <title>edit</title>
    <style>
    </style>
</head>
<body>
    <div class="wrapper wrapper-content animated fadeInRight">
        <form class="form-horizontal m-t" id="mainForm">
            <input type="hidden" id="Id" name="Id" value="@entity.Id" />
            <input type="hidden" id="State" name="State" value="@entity.State" />

            @{
                if (state == 1)//报备待审
                {
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-xs-3 control-label">操作：</label>
                                <div class="col-xs-9">
                                    <select class="form-control sel" id="OperType" name="OperType">
                                        <option value="0">同意</option>
                                        <option value="1">拒绝</option>
                                    </select>
                                    @*<span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写用户名称</span>*@
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-xs-3 control-label">说明：</label>
                                <div class="col-xs-9">
                                    <input id="FilingAuditingRemark" name="FilingAuditingRemark" value="@entity.FilingAuditingRemark" type="text" class="form-control">
                                    @*<span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写用户登录名（手机号唯一）</span>*@
                                </div>
                            </div>
                        </div>
                    </div>
                }
                else if (state == 4)//订金确认
                {
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-xs-3 control-label">订金：</label>
                                <div class="col-xs-9">
                                    <input id="BargainMoney" name="BargainMoney" value="@entity.BargainMoney" type="text" class="form-control">
                                    @*<span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写用户登录名（手机号唯一）</span>*@
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-xs-3 control-label">时间：</label>
                                <div class="col-xs-9">
                                    <input type="text" class="form-control" style="width:99px;" id="SubscribeTime" name="SubscribeTime" readonly="readonly" value="@entity.SubscribeTime.ToString("yyyy-MM-dd")">
                                </div>
                            </div>
                        </div>
                    </div>
                }
                else if (state == 5)//首付款确认
                {
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-xs-3 control-label">首付款：</label>
                                <div class="col-xs-9">
                                    <input id="DownPaymentMoney" name="DownPaymentMoney" value="@entity.DownPaymentMoney" type="text" class="form-control">
                                    @*<span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写用户登录名（手机号唯一）</span>*@
                                </div>
                            </div>
                        </div>
                    </div>
                }
                else if (state == 9)//退房审核
                {
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-xs-3 control-label">操作：</label>
                                <div class="col-xs-9">
                                    <select class="form-control sel" id="OperType" name="OperType">
                                        <option value="0">同意</option>
                                        <option value="1">拒绝</option>
                                    </select>
                                    @*<span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写用户名称</span>*@
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-xs-3 control-label">说明：</label>
                                <div class="col-xs-9">
                                    <input id="ReturnHouseAuditingRemark" name="ReturnHouseAuditingRemark" value="@entity.ReturnHouseAuditingRemark" type="text" class="form-control">
                                    @*<span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写用户登录名（手机号唯一）</span>*@
                                </div>
                            </div>
                        </div>
                    </div>
                }
            }






            <div class="row">
                <div class="col-sm-6">

                </div>
                <div class="col-sm-6">
                    <div class="pull-right">
                        <button id="submit" class="btn btn-primary pull-center" type="submit">
                            <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                        </button>
                    </div>
                </div>
            </div>


        </form>

    </div>
    <!-- 全局js -->
    <script type="text/javascript" src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="~/Scripts/bootstrap.min.js?v=3.3.6"></script>

    <!-- jQuery Validation plugin javascript-->
    <script type="text/javascript" src="~/Scripts/plugins/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript" src="~/Scripts/Extensions/ExtValidator.js"></script>

    <!-- layer javascript -->
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>

    <!-- 时间格式 -->
    <script src="~/Scripts/plugins/layer/laydate/laydate.js"></script>
    <script src="~/Scripts/TimeObjectUtil.js"></script>

    <script>

        if (parseInt(@ViewData["state"]) == 4) {

            laydate({
                elem: '#SubscribeTime',
                format: 'YYYY-MM-DD', // 分隔符可以任意定义，该例子表示只显示年月
                festival: true, //显示节日
                max: laydate.now(), //设定最小日期为当前日期
                min: '2010-01-01 00:00:00', //最大日期
                choose: function (datas) { //选择日期完毕的回调
                    //alert('得到：' + datas);
                }
            });

            function selectDate(day) {
                var mydate = new Date();

                if (day == -1) {
                    mydate.setYear(mydate.getFullYear() - 20);
                }
                else {
                    mydate.setDate(mydate.getDate() - day);
                }

                var beginDate = "" + mydate.getFullYear() + "-";
                beginDate += (mydate.getMonth() + 1) + "-";
                beginDate += mydate.getDate();
                $("#SubscribeTime").val(beginDate);

            }
        }

        $(function () {
            // validate signup form on keyup and submit
            var icon = "<i class='fa fa-times-circle'></i> ";
            var validator = $("#mainForm").validate({
                rules: {
                    //IntermediaryName: {
                    //    required: true
                    //},
                    //CityName: {
                    //    required: true
                    //},
                    //Name: {
                    //    required: true
                    //},
                    //Phone: {
                    //    required: true,
                    //    Phone: true
                    //},
                    BargainMoney: {
                        number: true
                    },
                    DownPaymentMoney: {
                        number: true
                    }
                },
                messages: {
                    //IntermediaryName: {
                    //    required: icon + "请选择中介"
                    //},
                    //CityName: {
                    //    required: icon + "请选择城市"
                    //},
                    //Name: {
                    //    required: icon + "请输入经纪人姓名"
                    //},
                    //Phone: {
                    //    required: icon + "请输入经纪人电话",
                    //    Phone: icon + '请输入正确的电话号'
                    //},
                    BargainMoney: {
                        number: icon + "订金必须是数字"
                    },
                    DownPaymentMoney: {
                        number: icon + "首付款必须是数字"
                    }
                },
                submitHandler: function (form) {
                    //alert(JSON.stringify($('#mainForm').serialize()));
                    //return;
                    //进行ajax传值
                    $.ajax({
                        url: "/Runnings/Runnings/OperIndexAsync",
                        type: "post",
                        dataType: "json",
                        data: $('#mainForm').serialize(),
                        success: function (data) {
                            //Info,Success,Warning,Error
                            var type = data.type;
                            if (type == 1) {
                                layer.msg(data.content, { icon: 6, time: 2000 },
                                 function () {
                                     var index = parent.layer.getFrameIndex(window.name);
                                     parent.layer.close(index);
                                 });

                            } else {
                                layer.msg(data.content, { icon: 5, time: 2000 });
                            }
                        }
                    });
                }
            });
        });


    </script>
</body>
</html>
